package com.cloudm.technician.ui.modules.cloudm_box.machine_history

import android.view.View
import android.view.ViewGroup
import com.cloudm.technician.R
import com.cloudm.technician.data.model.DeviceInfo
import com.cloudm.technician.extensions.inflate
import com.cloudm.technician.ui.base.BaseAdapter
import com.cloudm.technician.ui.base.BaseViewHolder
import kotlinx.android.synthetic.main.item_machine_history.view.*

/**
 * 作者: wesley
 * 时间: 2017/12/25
 * 描述: 适配器
 */
class MachineHistoryAdapter : BaseAdapter<DeviceInfo>() {

    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseViewHolder<DeviceInfo> {

        return ItemViewHolder(parent?.inflate(R.layout.item_machine_history))
    }

    class ItemViewHolder(itemView: View?) : BaseViewHolder<DeviceInfo>(itemView) {
        override fun onBind(t: DeviceInfo) {
            itemView.item_name_customer_info.text = t.deviceName
            itemView.item_time.text = t.transferTime
            itemView.item_equipment_history_brand.text = itemView.context.resources.getString(
                    R.string.transer_to, t.nickname)
        }
    }
}